package rdd

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark01_RDD_Memory {
  //从内存中创建RDD
  def main(args: Array[String]): Unit = {
    val sparkConf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sparkContext = new SparkContext(sparkConf)
    val seq: Seq[Int] = Seq[Int](1, 2, 34, 4)
    //parallelize为并行计算
//    val rdd: RDD[Int] = sparkContext.parallelize(seq)

    val rdd: RDD[Int] = sparkContext.makeRDD(seq)
    println(rdd)
//    rdd.collect().foreach(println)
    sparkContext.stop()
  }

}
